﻿// balance.h:基于规定的组件对金钱进行增加和减少。
//代码：2-大赢 1-赢 0-回本 -1-输 -2-输麻了 

#include <iostream>

class balance
{
public:
	explicit balance(int b= 1000) {
		balancer = b;
	}
	void change1(int n,int m)//基于既定结果设定余额变动。不取决于除最终结果的其他因素。m是单局代价。第一套规则。
	{
		switch (n)
		{
		case 2:
		{
			balancer += 3.5 * m;
			std::cout << "恭喜您大赢！您获得了2.5倍的代价，那是\t" << 2.5 * m << "g。\n您的余额是：" << balancer;
			break;
		}
		case 1:
		{
			balancer += 2 * m;
			std::cout << "恭喜您赢！您获得了您的代价，那是\t" << m << "g。\n您的余额是：" << balancer;
			break;
		}
		case 0:
		{
			balancer += m;
			std::cout << "您回本了。\n您的余额是：" << balancer;
			break;
		}
		case -1:
		{
			balancer -= m;
			std::cout << "哦不！您输！您失去了您的代价，那是\t" <<  m << "g。\n您的余额是：" << balancer;
			break;
		}
		case -2:
		{
			balancer -= m * 2.5;
			std::cout << "哦不！您大输！您失去了2.5倍的代价，那是\t" << 2.5 * m << "g。\n不用担心，您仍有：" << balancer;
		}
		}
	}

private:
	int balancer;
};
